var cradle = require('cradle'); 
var db = new(cradle.Connection)().database('bloquec8'); 
db.save('_design/disenoc8', { 
        views: { 
                vistac8: { 
                        map: function(doc) { 
                                  var buscar = 'ciudad';
  							if (doc.interes) {
    								 if ( doc.interes == buscar ){
									emit(doc.interes,doc);
     							}
  							}
                        }
                }
        },
        lists: { 
                listac8: function(head, req) { 
                        var row; start({ "headers": { "Content-Type": "text/html" } });
                        send("<table>");
                        while(row = getRow()) { 
                                send( "<tr><td> Interes: " + row.key + "</td><td> Lugar: "+ row.value.sitio + "</td></tr>\n");  
                        }
                        send("</table>\n");
                } 
        } 
});
